package com.ruoyi.web.controller.InterfaceUse;

import com.alibaba.fastjson.JSONObject;

import com.ruoyi.common.utils.util.costant.Result;
import com.ruoyi.system.domain.InterfaceUse.vo.Glapq;
import com.ruoyi.system.service.GlapService;
import com.ruoyi.system.service.impl.CreateDocImpl;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

@Controller
@RequestMapping("/api")
public class HesiAndT100 {

    @Autowired
    private GlapService glapService;
    @Autowired
    private CreateDocImpl createDoc;

    @PostMapping("/saveData")
    public Object saveData(@RequestBody Glapq glapq) {
        if ((glapq.getUserID().equals("1001")) && (glapq.getPassword().equals("123456"))) {
            return glapService.insertGlaq(glapq);
        }else{
            return Result.error("认证失败！！！");
        }
    }

    @ResponseBody
    @GetMapping("/createDoc")
    public Object createDoc(){
        JSONObject paymentOrder = createDoc.createPaymentOrder();
        return Result.ok(paymentOrder);
//        System.out.println("进入接口");
//        return Result.ok("进入接口");
    }

    /**
     * 进入API调用界面
     */
    @RequiresPermissions("InterfaceUse:view")
    @GetMapping()
    public String InterfaceUse(){
        return "/system/InterfaceUse/InterfaceUse";
    }



}
